//
//  CredentialsCell.m
//  huien
//
//  Created by yiban on 2017/7/18.
//  Copyright © 2017年 lcb. All rights reserved.
//

#import "CredentialsCell.h"
@interface CredentialsCell ()
{
    
}
@property(nonatomic,strong)UIImageView *iconView;
@property(nonatomic,strong)UILabel *keyLab;
@property(nonatomic,strong)UILabel *ValueLab;
@property(nonatomic,strong)UIImageView *statusView;
@end
@implementation CredentialsCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
     
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
}
/// 根据数据模型来显示内容
- (void)showInfo:(id)model indexPath:(NSIndexPath *)indexPath
{
    self.data =model;
    self.indexPath=indexPath;
    InformationModel *info = (InformationModel*)model;

    self.keyLab.frame =CGRectMake(10, LcbHEIGHT(10), 70, LcbHEIGHT(20));
    self.keyLab.text = info.name;
    if (info.Id==5 && info.name.length>0) {
        self.iconView.frame =CGRectMake(self.keyLab.frame.origin.x+self.keyLab.frame.size.width+10, LcbHEIGHT(4), LcbHEIGHT(32), LcbHEIGHT(32));
        [self.iconView lcb_imageWithUrlStr:info.name];
    }else{
        self.ValueLab.frame =CGRectMake(self.keyLab.frame.origin.x+self.keyLab.frame.size.width+10, LcbHEIGHT(10), SCREEN_WIDTH/2, LcbHEIGHT(20));
        self.ValueLab.text = info.value;
    }
    self.statusView.frame =CGRectMake(SCREEN_WIDTH-42, LcbHEIGHT(4), LcbHEIGHT(32), LcbHEIGHT(32));
    if (info.status==0) {
        self.statusView.image = [UIImage imageNamed:@"icon_unok"];
    }else
    {
        self.statusView.image = [UIImage imageNamed:@"icon_ok"];
    }
    
}
+(CGFloat)returnCellHeight
{
    return LcbHEIGHT(40);
}
-(void)dealloc
{
    [LcbLog log:@"UserInfoTableViewCell--------->dealloc"];
}
-(UILabel*)keyLab
{
    if (!_keyLab) {
        _keyLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 20)];
        _keyLab.font = [UIFont systemFontOfSize:15];
        _keyLab.textColor = h1color;
        _keyLab.textAlignment = NSTextAlignmentLeft;
        _keyLab.backgroundColor = [UIColor clearColor];
        [self addSubview:_keyLab];
    }
    return _keyLab;
}
-(UILabel*)ValueLab
{
    if (!_ValueLab) {
        _ValueLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 20)];
        _ValueLab.font = [UIFont systemFontOfSize:15];
        _ValueLab.textColor = h1color;
        _ValueLab.textAlignment = NSTextAlignmentLeft;
        _ValueLab.backgroundColor = [UIColor clearColor];
        [self addSubview:_ValueLab];
    }
    return _ValueLab;
}
-(UIImageView*)iconView
{
    if (!_iconView) {
        _iconView =[[UIImageView alloc] initWithFrame:CGRectZero];
        [self addSubview:_iconView];
    }
    return _iconView;
}
-(UIImageView*)statusView
{
    if (!_statusView) {
        _statusView =[[UIImageView alloc] initWithFrame:CGRectZero];
        [self addSubview:_statusView];
    }
    return _statusView;
}
@end
